\(\int \cot ^2(c+d x) \csc (c+d x) (a+b \sin (c+d x)) \, dx\) [1055]

   Optimal result
   Rubi [A] (verified)
   Mathematica [C] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 25, antiderivative size = 52 \[ \int \cot ^2(c+d x) \csc (c+d x) (a+b \sin (c+d x)) \, dx=-b x+\frac {a \text {arctanh}(\cos (c+d x))}{2 d}-\frac {b \cot (c+d x)}{d}-\frac {a \cot (c+d x) \csc (c+d x)}{2 d} \]

[Out]

-b*x+1/2*a*arctanh(cos(d*x+c))/d-b*cot(d*x+c)/d-1/2*a*cot(d*x+c)*csc(d*x+c)/d

Rubi [A] (verified)

Time = 0.06 (sec) , antiderivative size = 52, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.200, Rules used = {2917, 2691, 3855, 3554, 8} \[ \int \cot ^2(c+d x) \csc (c+d x) (a+b \sin (c+d x)) \, dx=\frac {a \text {arctanh}(\cos (c+d x))}{2 d}-\frac {a \cot (c+d x) \csc (c+d x)}{2 d}-\frac {b \cot (c+d x)}{d}-b x \]

[In]

Int[Cot[c + d*x]^2*Csc[c + d*x]*(a + b*Sin[c + d*x]),x]

[Out]

-(b*x) + (a*ArcTanh[Cos[c + d*x]])/(2*d) - (b*Cot[c + d*x])/d - (a*Cot[c + d*x]*Csc[c + d*x])/(2*d)

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 2691

Int[((a_.)*sec[(e_.) + (f_.)*(x_)])^(m_.)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[b*(a*Sec[e +
 f*x])^m*((b*Tan[e + f*x])^(n - 1)/(f*(m + n - 1))), x] - Dist[b^2*((n - 1)/(m + n - 1)), Int[(a*Sec[e + f*x])
^m*(b*Tan[e + f*x])^(n - 2), x], x] /; FreeQ[{a, b, e, f, m}, x] && GtQ[n, 1] && NeQ[m + n - 1, 0] && Integers
Q[2*m, 2*n]

Rule 2917

Int[(cos[(e_.) + (f_.)*(x_)]*(g_.))^(p_)*((d_.)*sin[(e_.) + (f_.)*(x_)])^(n_.)*((a_) + (b_.)*sin[(e_.) + (f_.)
*(x_)]), x_Symbol] :> Dist[a, Int[(g*Cos[e + f*x])^p*(d*Sin[e + f*x])^n, x], x] + Dist[b/d, Int[(g*Cos[e + f*x
])^p*(d*Sin[e + f*x])^(n + 1), x], x] /; FreeQ[{a, b, d, e, f, g, n, p}, x]

Rule 3554

Int[((b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[b*((b*Tan[c + d*x])^(n - 1)/(d*(n - 1))), x] - Dis
t[b^2, Int[(b*Tan[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1]

Rule 3855

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps \begin{align*} \text {integral}& = a \int \cot ^2(c+d x) \csc (c+d x) \, dx+b \int \cot ^2(c+d x) \, dx \\ & = -\frac {b \cot (c+d x)}{d}-\frac {a \cot (c+d x) \csc (c+d x)}{2 d}-\frac {1}{2} a \int \csc (c+d x) \, dx-b \int 1 \, dx \\ & = -b x+\frac {a \text {arctanh}(\cos (c+d x))}{2 d}-\frac {b \cot (c+d x)}{d}-\frac {a \cot (c+d x) \csc (c+d x)}{2 d} \\ \end{align*}

Mathematica [C] (verified)

Result contains higher order function than in optimal. Order 5 vs. order 3 in optimal.

Time = 0.03 (sec) , antiderivative size = 109, normalized size of antiderivative = 2.10 \[ \int \cot ^2(c+d x) \csc (c+d x) (a+b \sin (c+d x)) \, dx=-\frac {a \csc ^2\left (\frac {1}{2} (c+d x)\right )}{8 d}-\frac {b \cot (c+d x) \operatorname {Hypergeometric2F1}\left (-\frac {1}{2},1,\frac {1}{2},-\tan ^2(c+d x)\right )}{d}+\frac {a \log \left (\cos \left (\frac {1}{2} (c+d x)\right )\right )}{2 d}-\frac {a \log \left (\sin \left (\frac {1}{2} (c+d x)\right )\right )}{2 d}+\frac {a \sec ^2\left (\frac {1}{2} (c+d x)\right )}{8 d} \]

[In]

Integrate[Cot[c + d*x]^2*Csc[c + d*x]*(a + b*Sin[c + d*x]),x]

[Out]

-1/8*(a*Csc[(c + d*x)/2]^2)/d - (b*Cot[c + d*x]*Hypergeometric2F1[-1/2, 1, 1/2, -Tan[c + d*x]^2])/d + (a*Log[C
os[(c + d*x)/2]])/(2*d) - (a*Log[Sin[(c + d*x)/2]])/(2*d) + (a*Sec[(c + d*x)/2]^2)/(8*d)

Maple [A] (verified)

Time = 0.28 (sec) , antiderivative size = 71, normalized size of antiderivative = 1.37

method result size
derivativedivides \(\frac {a \left (-\frac {\cos ^{3}\left (d x +c \right )}{2 \sin \left (d x +c \right )^{2}}-\frac {\cos \left (d x +c \right )}{2}-\frac {\ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{2}\right )+b \left (-\cot \left (d x +c \right )-d x -c \right )}{d}\) \(71\)
default \(\frac {a \left (-\frac {\cos ^{3}\left (d x +c \right )}{2 \sin \left (d x +c \right )^{2}}-\frac {\cos \left (d x +c \right )}{2}-\frac {\ln \left (\csc \left (d x +c \right )-\cot \left (d x +c \right )\right )}{2}\right )+b \left (-\cot \left (d x +c \right )-d x -c \right )}{d}\) \(71\)
parallelrisch \(\frac {-a \left (\cot ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) a -8 b x d -4 b \cot \left (\frac {d x}{2}+\frac {c}{2}\right )-4 a \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )+4 b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{8 d}\) \(76\)
risch \(-b x -\frac {i \left (i a \,{\mathrm e}^{3 i \left (d x +c \right )}+i a \,{\mathrm e}^{i \left (d x +c \right )}+2 b \,{\mathrm e}^{2 i \left (d x +c \right )}-2 b \right )}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )^{2}}-\frac {a \ln \left ({\mathrm e}^{i \left (d x +c \right )}-1\right )}{2 d}+\frac {a \ln \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}{2 d}\) \(103\)
norman \(\frac {-\frac {a}{8 d}+\frac {a \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{8 d}-\frac {b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{2 d}+\frac {b \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2 d}-b x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-b x \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-\frac {a \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{4 d}}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} \left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}-\frac {a \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2 d}\) \(148\)

[In]

int(cos(d*x+c)^2*csc(d*x+c)^3*(a+b*sin(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

1/d*(a*(-1/2/sin(d*x+c)^2*cos(d*x+c)^3-1/2*cos(d*x+c)-1/2*ln(csc(d*x+c)-cot(d*x+c)))+b*(-cot(d*x+c)-d*x-c))

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 114 vs. \(2 (48) = 96\).

Time = 0.29 (sec) , antiderivative size = 114, normalized size of antiderivative = 2.19 \[ \int \cot ^2(c+d x) \csc (c+d x) (a+b \sin (c+d x)) \, dx=-\frac {4 \, b d x \cos \left (d x + c\right )^{2} - 4 \, b d x - 4 \, b \cos \left (d x + c\right ) \sin \left (d x + c\right ) - 2 \, a \cos \left (d x + c\right ) - {\left (a \cos \left (d x + c\right )^{2} - a\right )} \log \left (\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) + {\left (a \cos \left (d x + c\right )^{2} - a\right )} \log \left (-\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right )}{4 \, {\left (d \cos \left (d x + c\right )^{2} - d\right )}} \]

[In]

integrate(cos(d*x+c)^2*csc(d*x+c)^3*(a+b*sin(d*x+c)),x, algorithm="fricas")

[Out]

-1/4*(4*b*d*x*cos(d*x + c)^2 - 4*b*d*x - 4*b*cos(d*x + c)*sin(d*x + c) - 2*a*cos(d*x + c) - (a*cos(d*x + c)^2
- a)*log(1/2*cos(d*x + c) + 1/2) + (a*cos(d*x + c)^2 - a)*log(-1/2*cos(d*x + c) + 1/2))/(d*cos(d*x + c)^2 - d)

Sympy [F]

\[ \int \cot ^2(c+d x) \csc (c+d x) (a+b \sin (c+d x)) \, dx=\int \left (a + b \sin {\left (c + d x \right )}\right ) \cos ^{2}{\left (c + d x \right )} \csc ^{3}{\left (c + d x \right )}\, dx \]

[In]

integrate(cos(d*x+c)**2*csc(d*x+c)**3*(a+b*sin(d*x+c)),x)

[Out]

Integral((a + b*sin(c + d*x))*cos(c + d*x)**2*csc(c + d*x)**3, x)

Maxima [A] (verification not implemented)

none

Time = 0.37 (sec) , antiderivative size = 66, normalized size of antiderivative = 1.27 \[ \int \cot ^2(c+d x) \csc (c+d x) (a+b \sin (c+d x)) \, dx=-\frac {4 \, {\left (d x + c + \frac {1}{\tan \left (d x + c\right )}\right )} b - a {\left (\frac {2 \, \cos \left (d x + c\right )}{\cos \left (d x + c\right )^{2} - 1} + \log \left (\cos \left (d x + c\right ) + 1\right ) - \log \left (\cos \left (d x + c\right ) - 1\right )\right )}}{4 \, d} \]

[In]

integrate(cos(d*x+c)^2*csc(d*x+c)^3*(a+b*sin(d*x+c)),x, algorithm="maxima")

[Out]

-1/4*(4*(d*x + c + 1/tan(d*x + c))*b - a*(2*cos(d*x + c)/(cos(d*x + c)^2 - 1) + log(cos(d*x + c) + 1) - log(co
s(d*x + c) - 1)))/d

Giac [A] (verification not implemented)

none

Time = 0.33 (sec) , antiderivative size = 95, normalized size of antiderivative = 1.83 \[ \int \cot ^2(c+d x) \csc (c+d x) (a+b \sin (c+d x)) \, dx=\frac {a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 8 \, {\left (d x + c\right )} b - 4 \, a \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) \right |}\right ) + 4 \, b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + \frac {6 \, a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 4 \, b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - a}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2}}}{8 \, d} \]

[In]

integrate(cos(d*x+c)^2*csc(d*x+c)^3*(a+b*sin(d*x+c)),x, algorithm="giac")

[Out]

1/8*(a*tan(1/2*d*x + 1/2*c)^2 - 8*(d*x + c)*b - 4*a*log(abs(tan(1/2*d*x + 1/2*c))) + 4*b*tan(1/2*d*x + 1/2*c)
+ (6*a*tan(1/2*d*x + 1/2*c)^2 - 4*b*tan(1/2*d*x + 1/2*c) - a)/tan(1/2*d*x + 1/2*c)^2)/d

Mupad [B] (verification not implemented)

Time = 9.95 (sec) , antiderivative size = 151, normalized size of antiderivative = 2.90 \[ \int \cot ^2(c+d x) \csc (c+d x) (a+b \sin (c+d x)) \, dx=\frac {b\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{2\,d}-\frac {b\,\mathrm {cot}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{2\,d}-\frac {a\,\ln \left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{2\,d}-\frac {2\,b\,\mathrm {atan}\left (\frac {2\,b\,\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )+a\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{a\,\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )-2\,b\,\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{d}-\frac {a\,{\mathrm {cot}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2}{8\,d}+\frac {a\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2}{8\,d} \]

[In]

int((cos(c + d*x)^2*(a + b*sin(c + d*x)))/sin(c + d*x)^3,x)

[Out]

(b*tan(c/2 + (d*x)/2))/(2*d) - (b*cot(c/2 + (d*x)/2))/(2*d) - (a*log(sin(c/2 + (d*x)/2)/cos(c/2 + (d*x)/2)))/(
2*d) - (2*b*atan((2*b*cos(c/2 + (d*x)/2) + a*sin(c/2 + (d*x)/2))/(a*cos(c/2 + (d*x)/2) - 2*b*sin(c/2 + (d*x)/2
))))/d - (a*cot(c/2 + (d*x)/2)^2)/(8*d) + (a*tan(c/2 + (d*x)/2)^2)/(8*d)